package anthology.daily_question._24_10;

import java.util.Arrays;

//https://leetcode.cn/problems/smallest-range-i/description/?envType=daily-question&envId=2024-10-20
public class _0908最小差值1 {
    static public int smallestRangeI(int[] nums, int k) {
        int min = Arrays.stream(nums).min().getAsInt();
        int max = Arrays.stream(nums).max().getAsInt();
        return max - min <= 2 * k ? 0 : max-min-2*k;
    }
    public static void main(String[] args) {
        int[] num = {1,3,6};
        System.out.println(smallestRangeI(num,3));
    }
}
